package com.micro.turtle.model;

import cn.hutool.core.annotation.Alias;
import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Git Jobs
 *
 * @author jason.lv
 * @since 2022/1/21 15:39
 */
@NoArgsConstructor
@Data
public class Job {


    @Alias("id")
    private Integer id;
    @Alias("status")
    private String status;
    @Alias("stage")
    private String stage;
    @Alias("name")
    private String name;
    @Alias("ref")
    private String ref;
    @Alias("tag")
    private Boolean tag;
    @Alias("coverage")
    private Object coverage;
    @Alias("allow_failure")
    private Boolean allowFailure;
    @Alias("created_at")
    private String createdAt;
    @Alias("started_at")
    private Object startedAt;
    @Alias("finished_at")
    private Object finishedAt;
    @Alias("duration")
    private Object duration;
    @Alias("queued_duration")
    private Object queuedDuration;
    @Alias("user")
    private UserDTO user;
    @Alias("commit")
    private CommitDTO commit;
    @Alias("pipeline")
    private PipelineDTO pipeline;
    @Alias("web_url")
    private String webUrl;
    @Alias("artifacts")
    private List<?> artifacts;
    @Alias("runner")
    private Object runner;
    @Alias("artifacts_expire_at")
    private Object artifactsExpireAt;
    @Alias("tag_list")
    private List<?> tagList;

    @NoArgsConstructor
    @Data
    public static class UserDTO {

        @Alias("id")
        private Integer id;
        @Alias("name")
        private String name;
        @Alias("username")
        private String username;
        @Alias("state")
        private String state;
        @Alias("avatar_url")
        private String avatarUrl;
        @Alias("web_url")
        private String webUrl;
        @Alias("created_at")
        private String createdAt;
        @Alias("bio")
        private String bio;
        @Alias("bio_html")
        private String bioHtml;
        @Alias("location")
        private String location;
        @Alias("public_email")
        private String publicEmail;
        @Alias("skype")
        private String skype;
        @Alias("linkedin")
        private String linkedin;
        @Alias("twitter")
        private String twitter;
        @Alias("website_url")
        private String websiteUrl;
        @Alias("organization")
        private String organization;
        @Alias("job_title")
        private String jobTitle;
        @Alias("bot")
        private Boolean bot;
        @Alias("work_information")
        private Object workInformation;
        @Alias("followers")
        private Integer followers;
        @Alias("following")
        private Integer following;
    }

    @NoArgsConstructor
    @Data
    public static class CommitDTO {

        @Alias("id")
        private String id;
        @Alias("short_id")
        private String shortId;
        @Alias("created_at")
        private String createdAt;
        @Alias("parent_ids")
        private List<String> parentIds;
        @Alias("title")
        private String title;
        @Alias("message")
        private String message;
        @Alias("author_name")
        private String authorName;
        @Alias("author_email")
        private String authorEmail;
        @Alias("authored_date")
        private String authoredDate;
        @Alias("committer_name")
        private String committerName;
        @Alias("committer_email")
        private String committerEmail;
        @Alias("committed_date")
        private String committedDate;
        @Alias("web_url")
        private String webUrl;
    }

    @NoArgsConstructor
    @Data
    public static class PipelineDTO {

        @Alias("id")
        private Integer id;
        @Alias("project_id")
        private Integer projectId;
        @Alias("sha")
        private String sha;
        @Alias("ref")
        private String ref;
        @Alias("status")
        private String status;
        @Alias("created_at")
        private String createdAt;
        @Alias("updated_at")
        private String updatedAt;
        @Alias("web_url")
        private String webUrl;
    }
}
